<?php
/*
* Kusht Mud.
* ----
* The MIT License
* Copyright (c) 2010 Andrew Tutt
* ----
*/

/* Kusht Vars
*
* All of the Game-Specific Variables (These are Global, non-Dynamic)
*/

/* The decision was made very early that everything, if Enumerable (within reason) would be set with All_Flags in BaseObject and
*  Not with it's own inner variable. This decision was made for 4 reasons: (1) ease/simplicity, (2) flexibility (3) reliability
*  (4) The loss in execution speed is, in fact, zero, thanks to our efficient implementation of extended bits.
*
*  Thus, Every Variable Dealing with an Object Flag, Option, Setting, or Anything in-between should be set with a unique ID. 
*  These ids are processed as a variable-length "Bit array" that goes into BaseObject's all_flags field. 
*  Because they are linearly independent, any flag can be switched on and off without affecting any other
*  flags. Flags CAN be compared as if they are greater than and less than each other, as long as their IDs are monotonically increasing or decreasing
*  (just as one would expect), since they can of course be back-converted to their ID for comparison operations.

*  To set a variable as part of the global flags, simply add it to $GAMEFLAGS */

global $GAMEFLAGS;
$GAMEFLAGS = array();

/* A Note About Bits */
/* On a 32-Bit System, the Maximum Shift (<<) of a single 4-Byte Int that is still useful is 1 << 30 (so 31 options + '0' for 32 available states). 
*  However, the BIT Functions IS_SET, SET_BIT, and RMV_BIT are overloaded to support bit Arrays. So for an 8-Byte Array the number of available
*  states is 31 + 31 = 62, for a 12-Byte it's 93, etc. 

*  But this is all handled automatically, so add as many flags as you like.

*/

/*
 * Game parameters.
 */
// define("MAX_SKILL",		90); We have no limit on how many skills can be learned...
define("MAX_LEVEL",		40);

/*
 * Game Timing -- Right now we measure soley in seconds. Fractions are A'ok
 */


/* RESERVED GAME DEFAULT VALUES */
define("DEF_NEG",   -1);
define("INFINITE",	-1);

/* TIMEKEEPING */
define("SEC",		1);
define("MIN",		60);
define("HOUR",		3600);
define("DAY",		86400);

/* LISTENER BINDINGS */
define("TIME",		"time"); // A unique binding for Timed Event Triggers
define("SIT",		"sit");

// All Commands Are considered valid binders, so don't set up conflicts with
// preexisting commands here -- Maybe we should redeclare to remove all doubt. Let us do that.

/* DATA FORMAT PACKAGING VARS */
define("TEXT",  			"text");
define("GAME_TITLE",    	"game_title");
define("GAME_SUBTITLE", 	"game_subtitle");
define("GAME_COPYRIGHT",	"game_copyright");

/* For Exotic Game Fontss */
// Levels are 1 to 3
define("SAXON_LEVEL_1",    "saxon_level_1");
define("SAXON_LEVEL_2",    "saxon_level_2");
define("SAXON_LEVEL_3",    "saxon_level_3");

define("IN_ROOM",				"in_room");
define("VISIBLE_EXITS",			"visible_exits");
define("PEOPLE_IN_ROOM",		"people_in_room");
define("ITEMS_IN_ROOM",			"items_in_room");

/*
* Target Scope for Actions in CmdHandler
*/
define("TO_CHAR",		"to_char");
define("TO_TARG",		"to_targ");
define("TO_ROOM",		"to_room");
define("TO_NOTTARG",	"to_nottarg");

/*
* Common Exits
*/
// Syntax is: ExitName, ExitCommand, ModifierSelf, ModifierOthers
// where ModifierSelf is like "You walk into" vs. "You walk"
define("NORTH",			0);
define("SOUTH",			1);
define("EAST",			2);
define("WEST",			3);
define("UP",			4);
define("DOWN",			5);
define("GO",			6);
define("ENTER",			7);
define("LEAVE",			8);
define("EXIT_",			9);

/*
 * Damage Types
 */
define("HIT",			0);
define("SLICE",			1);
define("STAB",			2);
define("SLASH",			3);
define("WHIP",			4);
define("CLAW",			5);
define("BLAST",			6);
define("POUND",			7);
define("CRUSH",			8);
define("GRIP",			9);
define("BITE",			10);
define("PIERCE",		11);
define("SUCTION",		12);

/*
* Talk Channels
*/
/* Listening Off */

$GAMEFLAGS[] = "CHANNEL_DEAF"; // Truly deaf. Only Emotes. 
$GAMEFLAGS[] = "CHANNEL_NOTELL"; // No Tells.
$GAMEFLAGS[] = "CHANNEL_NONEWBIE";
$GAMEFLAGS[] = "CHANNEL_NOQUESTION";
$GAMEFLAGS[] = "CHANNEL_NOAUCTION";
$GAMEFLAGS[] = "CHANNEL_NOMUSIC";
$GAMEFLAGS[] = "CHANNEL_NOGOSSIP";
$GAMEFLAGS[] = "CHANNEL_NOSHOUT";
$GAMEFLAGS[] = "CHANNEL_NOYELL";
$GAMEFLAGS[] = "CHANNEL_NOHACKER";
$GAMEFLAGS[] = "CHANNEL_NOIMMTALK";

/* Speaking Off */
// These states disallow the action as opposed to disallowing the receipt.
$GAMEFLAGS[] = "CHANNEL_QUIET"; // Quiet mode means you have to be quiet too

$GAMEFLAGS[] = "PLR_NOCHANNELS";
$GAMEFLAGS[] = "PLR_SILENCE";
$GAMEFLAGS[] = "PLR_NO_EMOTE";
$GAMEFLAGS[] = "PLR_NO_TELL";

// Serious Actions -- Deny is no login, and freeze is no Commands accepted by client
$GAMEFLAGS[] = "PLR_DENY";
$GAMEFLAGS[] = "PLR_FREEZE";

/*
* User Options
*/
$GAMEFLAGS[] = "PLR_AUTOEXIT";
$GAMEFLAGS[] = "PLR_AUTOLOOT";
$GAMEFLAGS[] = "PLR_AUTOSAC";
$GAMEFLAGS[] = "PLR_BLANK";
$GAMEFLAGS[] = "PLR_BRIEF";
$GAMEFLAGS[] = "PLR_COMBINE";
$GAMEFLAGS[] = "PLR_PROMPT";
$GAMEFLAGS[] = "PLR_TELNET_GA";

$GAMEFLAGS[] = "PLR_THIEF";
$GAMEFLAGS[] = "PLR_KILLER";

/*
* Types of Exits && Objects -- Flags serve for both
*/
$GAMEFLAGS[] = "OPEN";
$GAMEFLAGS[] = "MUST_CLIMB";
$GAMEFLAGS[] = "IS_DOOR";
$GAMEFLAGS[] = "CLOSED";
$GAMEFLAGS[] = "LOCKED";
$GAMEFLAGS[] = "BASH_PROOF"; // For the Strong
$GAMEFLAGS[] = "KNOCK_PROOF"; // Magic Spell
$GAMEFLAGS[] = "PICK_PROOF";

/*
 * Sex.
 */
$GAMEFLAGS[] = "NOGENDER";
$GAMEFLAGS[] = "MALE";
$GAMEFLAGS[] = "FEMALE";


/*
 * Positions.
 */
$GAMEFLAGS[] = "DEAD";
$GAMEFLAGS[] = "MORTAL";
$GAMEFLAGS[] = "INCAP";
$GAMEFLAGS[] = "STUNNED";
$GAMEFLAGS[] = "SLEEPING";
$GAMEFLAGS[] = "RESTING";
$GAMEFLAGS[] = "FIGHTING";
$GAMEFLAGS[] = "STANDING";

/*
 * Conditions.
 */
$GAMEFLAGS[] = "DRUNK";
$GAMEFLAGS[] = "FULL";
$GAMEFLAGS[] = "THIRSTY";

/*
*  Sizes -> Potentially for use with containers
*/
$GAMEFLAGS[] = "COIN"; // All you can fit in your tiny coin purse are coins
$GAMEFLAGS[] = "TINY"; // But you can't stick them in your small pack because they'll
$GAMEFLAGS[] = "SMALL"; // Just be floating around in there.
$GAMEFLAGS[] = "MEDIUM";
$GAMEFLAGS[] = "BIG";
$GAMEFLAGS[] = "HUGE";
$GAMEFLAGS[] = "MASSIVE";
$GAMEFLAGS[] = "IMMENSE";

/* -- NOTE: THE CONSTANTS BELOW -- */
// They abide by our convention of using "Natural Language"
// whenever possible. Is it really ever going to happen that we will ever
// need to distinguish the "room_light" from the "item_light"?
// They are restricted to completely different Object types.

/*
 * Bits for 'affected_by'.
 */
$GAMEFLAGS[] = "HOLYLIGHT";
$GAMEFLAGS[] = "BLINDED";
$GAMEFLAGS[] = "DEAF"; // This is a temporary/possibly permanent flag (like truly going deaf or having a bomb go off near you)
$GAMEFLAGS[] = "MUTED"; // Lost voice

$GAMEFLAGS[] = "INVISIBLE";
$GAMEFLAGS[] = "DETECT_EVIL";
$GAMEFLAGS[] = "DETECT_INVIS";
$GAMEFLAGS[] = "DETECT_MAGIC";
$GAMEFLAGS[] = "DETECT_HIDDEN";

$GAMEFLAGS[] = "SANCTUARIED";
$GAMEFLAGS[] = "FAERIE_FIRED";
$GAMEFLAGS[] = "INFRARED";
$GAMEFLAGS[] = "CURSED";

$GAMEFLAGS[] = "POISONED";
$GAMEFLAGS[] = "PROTECTED";

$GAMEFLAGS[] = "SNEAKING";
$GAMEFLAGS[] = "HIDING";
$GAMEFLAGS[] = "FORCED_SLEEP";
$GAMEFLAGS[] = "CHARMED";
$GAMEFLAGS[] = "FLYING";
$GAMEFLAGS[] = "PASS_DOOR";

/*
 *	Item Types
 */
$GAMEFLAGS[] = "LIGHT";
$GAMEFLAGS[] = "SCROLL";
$GAMEFLAGS[] = "WAND";
$GAMEFLAGS[] = "STAFF";
$GAMEFLAGS[] = "WEAPON";
$GAMEFLAGS[] = "TREASURE";
$GAMEFLAGS[] = "ARMOR";
$GAMEFLAGS[] = "POTION";
$GAMEFLAGS[] = "FURNITURE";
$GAMEFLAGS[] = "TRASH";
$GAMEFLAGS[] = "CONTAINER";
$GAMEFLAGS[] = "DRINK_CON";
$GAMEFLAGS[] = "KEY";
$GAMEFLAGS[] = "FOOD";
$GAMEFLAGS[] = "MONEY";
$GAMEFLAGS[] = "BOAT";
$GAMEFLAGS[] = "NPC_CORPSE";
$GAMEFLAGS[] = "PC_CORPSE";
$GAMEFLAGS[] = "FOUNTAIN";
$GAMEFLAGS[] = "PILL";
	
/*
 * Extra flags.
 */
$GAMEFLAGS[] = "GLOWING";
$GAMEFLAGS[] = "HUMMING";
$GAMEFLAGS[] = "DARK";
//$GAMEFLAGS[] = "LOCK";
$GAMEFLAGS[] = "EVIL";
//$GAMEFLAGS[] = "INVIS";
$GAMEFLAGS[] = "MAGIC";
$GAMEFLAGS[] = "NOT_DROPPABLE";
$GAMEFLAGS[] = "BLESSED";
$GAMEFLAGS[] = "ANTI_GOOD";
$GAMEFLAGS[] = "ANTI_EVIL";
$GAMEFLAGS[] = "ANTI_NEUTRAL";
$GAMEFLAGS[] = "NOT_REMOVEABLE";
$GAMEFLAGS[] = "INVENTORY";

// Even more Flags
$GAMEFLAGS[] = "BROKEN";

/*
 * Wear flags. (We favor unset bits) (items have these)
 */
// We favor a force-flag policy -- you have to opt the functionality in
$GAMEFLAGS[] = "NOT_TAKEABLE";
$GAMEFLAGS[] = "WORN_ON_FINGER";
$GAMEFLAGS[] = "WORN_ON_NECK";
$GAMEFLAGS[] = "WORN_ON_BODY";
$GAMEFLAGS[] = "WORN_ON_HEAD";
$GAMEFLAGS[] = "WORN_ON_LEGS";
$GAMEFLAGS[] = "WORN_ON_FEET";
$GAMEFLAGS[] = "WORN_ON_HANDS";
$GAMEFLAGS[] = "WORN_ON_ARMS";
$GAMEFLAGS[] = "WORN_AS_SHIELD";
$GAMEFLAGS[] = "WORN_ABOUT";
$GAMEFLAGS[] = "WORN_ON_WAIST";
$GAMEFLAGS[] = "WORN_ON_WRIST";
$GAMEFLAGS[] = "WIELDABLE";
$GAMEFLAGS[] = "HOLDABLE";

/*
* Hardpoints
*/
$GAMEFLAGS[] = "WEAR_NONE";
$GAMEFLAGS[] = "AS_LIGHT";
$GAMEFLAGS[] = "LEFT_FINGER";
$GAMEFLAGS[] = "RIGHT_FINGER";
$GAMEFLAGS[] = "NECK";
$GAMEFLAGS[] = "BODY";
$GAMEFLAGS[] = "HEAD";
$GAMEFLAGS[] = "HANDS";
$GAMEFLAGS[] = "ARMS";
$GAMEFLAGS[] = "ABOUT_BODY";
$GAMEFLAGS[] = "WAIST";
$GAMEFLAGS[] = "LEFT_WRIST";
$GAMEFLAGS[] = "RIGHT_WRIST";
$GAMEFLAGS[] = "IN_LEFT_HAND";
$GAMEFLAGS[] = "IN_RIGHT_HAND";
$GAMEFLAGS[] = "MAX_WEAR";

/*
 * Sector types.
 */
$GAMEFLAGS[] = "INSIDE";
$GAMEFLAGS[] = "CITY";
$GAMEFLAGS[] = "FIELD";
$GAMEFLAGS[] = "FOREST";
$GAMEFLAGS[] = "HILLS";
$GAMEFLAGS[] = "MOUNTAIN";
$GAMEFLAGS[] = "WATER_SWIM";
$GAMEFLAGS[] = "WATER_NOSWIM";
$GAMEFLAGS[] = "UNUSED";
$GAMEFLAGS[] = "AIR";
$GAMEFLAGS[] = "DESERT";
$GAMEFLAGS[] = "MAX";

/*
* More Room Flags
*/

$GAMEFLAGS[] = "NO_MOB";
$GAMEFLAGS[] = "INDOORS";
$GAMEFLAGS[] = "PRIVATE";
$GAMEFLAGS[] = "SAFE";
$GAMEFLAGS[] = "SOLITARY";
$GAMEFLAGS[] = "PET_SHOP";
$GAMEFLAGS[] = "NO_RECALL";

/*
 * Apply types (for affects).
 */
// Note that a lot of these are, in fact, unused (Even in Diku)
$GAMEFLAGS[] = "MOD_NONE";
$GAMEFLAGS[] = "MOD_BLK"; // Bulk (Killing things with weapons)
$GAMEFLAGS[] = "MOD_INT"; // Intelligence (increases slowly over time if devoted)
$GAMEFLAGS[] = "MOD_ING"; // Ingenuity (solving puzzles)
$GAMEFLAGS[] = "MOD_SPD"; // Speed 
$GAMEFLAGS[] = "MOD_MAG"; // Magnetism
$GAMEFLAGS[] = "MOD_CNX"; // Connections (paying)
$GAMEFLAGS[] = "MOD_SEX";
$GAMEFLAGS[] = "MOD_CLASS";
$GAMEFLAGS[] = "MOD_LEVEL";
$GAMEFLAGS[] = "MOD_AGE";
$GAMEFLAGS[] = "MOD_HEIGHT";
$GAMEFLAGS[] = "MOD_WEIGHT";
$GAMEFLAGS[] = "MOD_MANA";
$GAMEFLAGS[] = "MOD_HIT";
$GAMEFLAGS[] = "MOD_MOVE";
$GAMEFLAGS[] = "MOD_GOLD";
$GAMEFLAGS[] = "MOD_EXP";
$GAMEFLAGS[] = "MOD_AC";
$GAMEFLAGS[] = "MOD_HITROLL";
$GAMEFLAGS[] = "MOD_DAMROLL";
$GAMEFLAGS[] = "MOD_SAVING_PARA";
$GAMEFLAGS[] = "MOD_SAVING_ROD";
$GAMEFLAGS[] = "MOD_SAVING_PETRI";
$GAMEFLAGS[] = "MOD_SAVING_BREATH";
$GAMEFLAGS[] = "MOD_SAVING_SPELL";

/*
* MINIGAMES-GLOBALS
*/
$GAMEFLAGS[] = "WAITING_FOR_CHESS";
$GAMEFLAGS[] = "PLAYING_CHESS";

// RACES (Which in Mythica are Origins, but whatever)
$GAMEFLAGS[] = "FRESIEN";		
$GAMEFLAGS[] = "WARISH";
$GAMEFLAGS[] = "HANIARD";
$GAMEFLAGS[] = "PENCHAN";

// Origin Stories
$GAMEFLAGS[] = "POOR_BACKGROUND";

// Special Character Flags
$GAMEFLAGS[] = "IMMORTAL";
$GAMEFLAGS[] = "HERO";

updateGameFlags();

// We don't care how slow it is
function updateGameFlags() {
	global $GAMEFLAGS;
		
	foreach($GAMEFLAGS as $k=>$F) {
		if(!defined($F)) { define($F,$k+1); }
	}
}

?>